package utils

import "regexp"

func IsEmail(text string) bool {
	pattern := `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*` // 匹配电子邮箱
	reg := regexp.MustCompile(pattern)
	return reg.MatchString(text)
}

func IsNumber(text string) bool {
	pattern := `^\d+(\.\d+)?$`
	reg := regexp.MustCompile(pattern)
	return reg.MatchString(text)
}

func IsString(text string) bool {
	pattern := "^\".*\"$|^'.*'$|^`.*`$"
	reg := regexp.MustCompile(pattern)
	return reg.MatchString(text)
}

func IsBool(text string) bool {
	pattern := `true|false`
	reg := regexp.MustCompile(pattern)
	return reg.MatchString(text)
}
